using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Universal.Domain.Entities.App;

namespace Universal.Infrastructure.DB.Config;

public class AppArticleConfiguration : IEntityTypeConfiguration<AppArticle>
{
    public void Configure(EntityTypeBuilder<AppArticle> builder)
    {
        // 一对多：article-category
        builder
            .HasOne(a => a.Category)
            .WithMany(c => c.Articles)
            .HasForeignKey(a => a.CategoryId);
    }
}
